﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
    <link href="~/jquery-easyui-1.5.2/themes/gray/easyui.css" rel="stylesheet" />
    <link href="~/jquery-easyui-1.5.2/themes/icon.css" rel="stylesheet" />
    <link href="~/jquery-easyui-1.5.2/demo/demo.css" rel="stylesheet" />
    <script src="~/jquery-easyui-1.5.2/jquery.min.js" type="text/javascript"></script>
    <script src="~/jquery-easyui-1.5.2/jquery.easyui.min.js" type="text/javascript"></script>

</head>
<body class="easyui-layout">

    <div data-options="region:'north',border:false" style="height:60px;background:#B3DFDA;padding:10px">
        <h2>房屋评估系统</h2>
    </div>

    <div class="wu-sidebar" data-options="region:'west',split:true,border:true,title:'导航菜单'" style="width:150px;padding:10px;">
        <div class="easyui-accordion" data-options="border:false,fit:true" id="div1">

        </div>
    </div>
    <div class="easyui-tabs" data-options="region:'center'" style="width:100%;height:100%" id="centertabs">
        <div title="首页" style="padding:10px">
            <iframe scrolling="yes" src="/Home/Index1" style="height:100%;width:100%" frameborder="0"></iframe>
        </div>

    </div>

    <div data-options="region:'south',border:false" style="height:50px;background:#A9FACD;padding:10px;">
        <div style="text-align:center">
            物联网工程学院1505.NETB<br />
            版权所有
        </div>
    </div>
    <script>
        aa();
        function aa() {
            $.ajax({
                    url: "http://localhost:25744/api/AuthorityAndRoles",
                    type: "get",
                    data: { roles_Id: 6, ParentId: 0 },
                    async: false,
                    success: function (data) {
                    var htmltab = "";
                    for (var i = 0; i < data.length; i++) {
                        htmltab += " <div title=\"" + data[i].authority_Name + "\" data-options=\"iconCls:'icon-application-cascade'\" style=\"padding: 5px;\" id=\"zhi" + data[i].authorityAndRoles_Id + "\"></div>,";
                        //分割
                        var result = htmltab.split(',');
                        //追加
                        $("#div1").append(result[i]);
                        var aa = "<span>" + parentId(data[i].authorityAndRoles_Id) + "</span>";
                    }
                },
                error: function (err) {
                    alert(err);
                }
            });
        }

        //显示子级节点
        function parentId(id) {
            $.ajax({
                    url: "http://localhost:25744/api/AuthorityAndRoles",
                    type: "get",
                    data: { roles_Id: 6, ParentId: id },
                    async: false,
                    success: function (obj) {
                   var strhtml = "<ul class='abcc' class=\"wu-side-tree\">";
                    for (var i = 0; i < obj.length; i++) {
                        strhtml += "<li iconcls=\"icon-chart-organisation\"> <a href=\"javascript:;\" _href=\"" + obj[i].authority_Url + "\" title=\"" + obj[i].authority_Name + "\">" + obj[i].authority_Name + "</a></li>";
                    }
                   
                    strhtml += "</ul>";
                    $("#zhi" + id + "").html(strhtml);
                    $(".abcc").addClass("easyui-tree");
                }
            })
        }
 
   
        $(function () {

            $("#div1 a").click(function () {
                if ($("#centertabs").tabs('exists', $(this).attr("title"))) {
                    $("#centertabs").tabs('select', $(this).attr("title"));
                }
                else {
                    var html = '<iframe scrolling="auto" src="' + $(this).attr("_href") + '" style="height:99%;width:99%" frameborder="0"></iframe>';
                    $("#centertabs").tabs('add', {
                        closable: true,
                        title: $(this).attr("title"),
                        content: html
                    })
                }
            })

            //如果选项卡已经打开  
            //if ($('#tabs').tabs('exists', title)) {
            //    //跳转到指定的选项卡页面  
            //    $('#tabs').tabs('select', title);

            //}

        })
    </script>

</body>
</html>
